<template>
  <div style="padding: 10px">
    <el-form ref="form" :model="form" label-width="80px">
      <el-row :gutter="20">
        <el-col :span="6"
          ><el-form-item label="租赁状态">
            <el-select
              v-model="form.enterpriseId"
              size="mini"
              placeholder="请选择活动区域"
            >
              <el-option v-for="item in enterpriseList" :key="item.value"
                :label="item.name" value="item.id">{{ item.name }}</el-option
              >
          
            </el-select> </el-form-item
        ></el-col>

        <el-col :span="6"
          ><el-form-item label="承租对象">
            <el-radio-group v-model="form.type">
              <el-radio :label="1">个人</el-radio>
              <el-radio :label="2">企业</el-radio>
            </el-radio-group>
          </el-form-item></el-col
        >
        <el-col :span="6"
          ><el-form-item label="企业名称">
            <el-input
              v-model="form.enterprise.name"
              size="mini"
              style="width: 200px"
              placeholder="企业名称"
            ></el-input> </el-form-item
        ></el-col>
        <el-col :span="6"
          ><el-form-item label="类别">
            <el-select
              v-model="form.enterprise.nature"
              size="mini"
              placeholder="请选择类别"
            >
              <el-option label="自营" value="1"></el-option>
              <el-option label="托管" value="2"></el-option>
            </el-select> </el-form-item
        ></el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="6">
          <el-form-item label="租赁面积">
            <el-input
              v-model="form.leaseArea"
              size="mini"
              style="width: 200px"
              placeholder="租赁计算面积"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6"
          ><el-form-item label="租赁时间">
            <el-col :span="11">
              <el-date-picker
                type="date"
                placeholder="选择日期"
                v-model="form.startDate"
                style="width: 100%"
                size="mini"
              ></el-date-picker>
            </el-col>
            <el-col class="line" :span="2">-</el-col>
            <el-col :span="11">
              <el-time-picker
                placeholder="选择时间"
                v-model="form.endDate"
                style="width: 100%"
                size="mini"
              ></el-time-picker>
            </el-col>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="水费">
            <el-input
              v-model="form.waterRate"
              size="mini"
              style="width: 200px"
              placeholder="水费单价(吨/元)"
            ></el-input> </el-form-item
        ></el-col>
        <el-col :span="6">
          <el-form-item label="押金">
            <el-input
              v-model="form.deposit"
              size="mini"
              style="width: 200px"
              placeholder="押金"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="24">
        <el-col :span="12">
          <el-form-item label="签订租金">
            <el-input
              v-model="form.rent"
              size="mini"
              style="width: 150px"
              placeholder="签订租金费用"
            ></el-input>
            <el-select
              v-model="form.rentType"
              size="mini"
              style="width: 200px; margin-left: 1%"
              placeholder="计费方式"
            >
              <el-option label="元/月" value="1"></el-option>
              <el-option label="元/平米/月" value="2"></el-option>
            </el-select>
            <el-select
              v-model="form.rentPayType"
              size="mini"
              style="width: 200px; margin-left: 1%"
              placeholder="请支付方式"
            >
              <el-option label="月付" value="1"></el-option>
              <el-option label="季付" value="2"></el-option>
              <el-option label="半年付" value="3"></el-option>
              <el-option label="年付" value="4"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="免租时间">
            <el-date-picker
              v-model="form.freeStartDate"
              type="daterange"
              size="mini"
              style="width: 300px"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
            >
            </el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="24">
        <el-col :span="12">
          <el-form-item label="签订物业">
            <el-input
              v-model="form.maintenance"
              size="mini"
              style="width: 150px"
              placeholder="签订物业费用"
            ></el-input>
            <el-select
              v-model="form.maintenanceType"
              size="mini"
              style="width: 200px; margin-left: 1%"
              placeholder="计费方式"
            >
              <el-option label="元/月" value="1"></el-option>
              <el-option label="元/平米/月" value="2"></el-option>
            </el-select>
            <el-select
              v-model="form.maintenancePayType"
              size="mini"
              style="width: 200px; margin-left: 1%"
              placeholder="请支付方式"
            >
              <el-option label="月付" value="1"></el-option>
              <el-option label="季付" value="2"></el-option>
              <el-option label="半年付" value="3"></el-option>
              <el-option label="年付" value="4"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12"
          ><el-form-item label="免租时间">
            <el-date-picker
              v-model="form.maintenanceFreeStartDate"
              type="daterange"
              size="mini"
              style="width: 300px"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
            >
            </el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>

      <el-divider content-position="left">人员信息</el-divider>
      <el-row :gutter="20">
        <el-col :span="6">
          <el-form-item label="姓名">
            <el-input
              v-model="form.user.name"
              size="mini"
              placeholder="请输入姓名"
              style="width: 200px"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="电话">
            <el-input
              v-model="form.user.phone"
              size="mini"
              placeholder="请输入电话"
              style="width: 200px"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="人员性质">
            <el-select
              v-model="form.user.type"
              size="mini"
              style="width: 200px"
              placeholder="请人员性质"
            >
              <el-option label="内部" value="1"></el-option>
              <el-option label="外部" value="2"></el-option>
              <el-option label="一线" value="3"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>

      <el-divider content-position="left">租金递增规则</el-divider>
      <el-row :gutter="24">
        <el-col :span="4">
          <el-form-item label="是否递增">
            <el-switch v-model="form.isb" active-text="是" inactive-text="否">
            </el-switch>
          </el-form-item>
        </el-col>
        <el-col :span="10" class="line" v-if="form.isb">
          <el-form-item label="是否递增">
            <el-select
              v-model="form.risesProportion.type2"
              size="mini"
              style="width: 150px; margin-left: 1%"
              placeholder="是否同比递增"
            >
              <el-option label="是" value="true"></el-option>
              <el-option label="否" value="false"></el-option>
            </el-select>
            <el-select
              v-model="form.risesProportion.type"
              size="mini"
              style="width: 150px; margin-left: 1%"
              placeholder="递增方式"
            >
              <el-option label="月付" value="1">月付</el-option>
              <el-option label="季付" value="2">季付</el-option>
              <el-option label="半年付" value="3">半年付</el-option>
              <el-option label="年付" value="4">年付</el-option>
            </el-select>
            <!-- {"type":4,"proportion":"3","type2":true} -->
            <el-input
              placeholder="租金递增率"
              v-model="form.risesProportion.proportion"
              size="mini"
              style="width: 150px; margin-left: 1%; margin-top: 1%"
            >
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-divider content-position="left">电费计算规则</el-divider>

      <el-divider content-position="left"> 企业车辆折扣信息</el-divider>
      <el-row :gutter="20">
        <el-col :span="6">
          <el-form-item label="停车费">
            <el-input
              v-model="form.parkingFee"
              size="mini"
              style="width: 200px"
              clearable
              placeholder="企业折扣停车费"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="车位个数">
            <el-input
              v-model="form.parkingFeeNumber"
              size="mini"
              style="width: 200px"
              clearable
              placeholder="折扣停车位个数"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="免费车位">
            <el-input
              v-model="form.freeParkingPlace"
              size="mini"
              style="width: 200px"
              clearable
              placeholder="企业签订免费车位数"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-divider content-position="left">企业信息</el-divider>
      <el-row :gutter="20">
        <el-col :span="6"
          ><el-form-item label="企业状态">
            <el-input
              v-model="form.enterprise.type"
              size="mini"
              style="width: 200px"
              placeholder="企业状态"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="所属行业">
            <el-input
              v-model="form.enterprise.industry"
              size="mini"
              style="width: 200px"
              placeholder="所属行业"
            ></el-input> </el-form-item
        ></el-col>
        <el-col :span="6"
          ><el-form-item label="信用代码">
            <el-input
              v-model="form.enterprise.creditCode"
              size="mini"
              style="width: 200px"
              placeholder="统一社会信用代码"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="6"
          ><el-form-item label="法人姓名">
            <el-input
              v-model="form.enterprise.corporationName"
              size="mini"
              style="width: 200px"
              placeholder="法人姓名"
            ></el-input> </el-form-item
        ></el-col>
        <el-col :span="6"
          ><el-form-item label="营业执号">
            <el-input
              v-model="form.enterprise.businessLicense"
              size="mini"
              style="width: 200px"
              placeholder="营业执照注册号"
            ></el-input> </el-form-item
        ></el-col>

        <el-col :span="6"
          ><el-form-item label="机构代码">
            <el-input
              v-model="form.enterprise.organizationCode"
              size="mini"
              style="width: 200px"
              placeholder="组织机构代码"
            ></el-input> </el-form-item
        ></el-col>

        <el-col :span="6"
          ><el-form-item label="成立日期">
            <el-input
              v-model="form.enterprise.establishDate"
              size="mini"
              style="width: 200px"
              placeholder="成立日期"
            ></el-input> </el-form-item
        ></el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="6"
          ><el-form-item label="注册地址">
            <el-input
              v-model="form.enterprise.registeredAddress"
              size="mini"
              style="width: 200px"
              placeholder="注册地址"
            ></el-input> </el-form-item
        ></el-col>

        <el-col :span="10"
          ><el-form-item label="经营范围">
            <el-input
              v-model="form.enterprise.businessScope"
              size="mini"
              style="width: 100%"
              placeholder="经营范围"
            ></el-input> </el-form-item
        ></el-col>
      </el-row>

      <el-row :gutter="20">
        <el-col :span="6"
          ><el-form-item label="营业执照">
            <el-input
              v-model="form.businessLicense"
              size="mini"
              style="width: 200px"
            ></el-input> </el-form-item
        ></el-col>
        <el-col :span="6"
          ><el-form-item label="法人身份证正面">
            <el-input
              v-model="form.corporationIDCard"
              size="mini"
              style="width: 200px"
            ></el-input> </el-form-item
        ></el-col>
        <el-col :span="6"
          ><el-form-item label="法人身份证反面">
            <el-input
              v-model="form.corporationIDCardBack"
              size="mini"
              style="width: 200px"
            ></el-input> </el-form-item
        ></el-col>
      </el-row>

      <el-row :gutter="20">
        <el-col :span="24" style="text-align: center">
          <el-button type="primary" @click="onSubmit">保存</el-button>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
  
  <script>
import { getVehicleList, save } from "@/api/car";
import { getEnterpriseList } from "@/api/commonapi";

export default {
  props: {},
  data() {
    return {
      enterpriseList: [],
      form: {
        enterpriseId: null,
        avatar: "",
        intro: "",
        merchantName: "",
        merchantAddress: "",
        merchantUser: "",
        merchantPhoe: "",
        businessHours: "",
        businessEndHours: "",
        merchantLabel: "",
        auditState: "",
        status: "",
        merchantPhoto: "",
        remarks: "",
      },
    };
  },
  computed: {},
  created() {
    getEnterprise();
  },
  mounted() {},
  watch: {},
  methods: {
    getEnterprise() {
      getEnterpriseList().then((res) => {
        this.enterpriseList = res.data;
      });
    },
    onSubmit() {
      save(this.form).then(() => {
        this.fetchData(this.where);
      });
    },
  },
  components: {},
};
</script>
  
  <style>
.el-form-item {
  margin-bottom: 12px;
}
</style>
  